<?php if($user->access!=0){ ?>
<?php
if ($user->access != 2){
	$_SESSION['error']="Acces refused";
}
else{
?>
<div id="page_admin">
<div id="gestion_serveur">
	<!-- Gestion des serveurs -->
	<form action="index.php?page=admin" method="post">
		<table>
		<caption>Add server</caption>
		<tr>
		<td> Nom* : <input type="text" name="server_name" /></td>
		<td>code* : <input type="text" name="server_pin" /></td>
		<td>adresse* : <input type="text" name="server_address" />(ex:http://lesprofs.free.fr/client/index.php)</td>
		<td><input type="hidden" name="hidden" value="add_server" /></td>
		<td><input type="submit" value="OK" /></td>
		</tr>
		</table>
	</form>
	<!-- Fin de Gestion des serveurs -->
<?php list_server("admin")?>


</div>
<div id="gestion_user">
<!-- Gestion des users -->
	<form action="index.php?page=admin" method="post">
		<table>
		<caption>Add a user</caption>
		<tr>
		<td>login* : <input type="text" name="user_login" /></td>
		<td>password* : <input type="password" name="user_password" /></td>
		<td>access* : <input type="text" name="user_access" />(0:bloked 1:user 2:admin)</td>
		<td><input type="hidden" name="hidden" value="add_user" /></td>
		<td><input type="submit" value="OK" /></td>
		</tr>
		</table>
	</form>
	<!-- Fin de Gestion des users -->
<?php list_user("admin")?>
</div>
<div id="div_log">
		<table>
		<caption>Log <a href="" onclick="window.location='index.php';">refresh</a></caption>
		<tr>
		<td class="title">Action</td><td class="title">User</td><td class="title">date</td><td class="title">server</td>
		</tr>
		<?php 
		$sql_query = mysql_query("Select action,server,user,date from ".DATABASE_TABLE_LOG." ORDER BY `date` DESC LIMIT 0 , 15");
		while ($query = mysql_fetch_array($sql_query)  ){
		?>
		<tr  bgcolor="#ffffff" onmouseout="this.bgColor='#FFFFFF';" onmouseover="this.bgColor='#DADADA';" >
		<td class="log_action"><?php print $query['action']; ?></td><td class = "log_user"><?php print $query['user']; ?></td><td class ="log_date"><?php print date( "d/m/y à G\h i\m",$query['date']) ; ?></td><td class="log_server"><?php print $query['server']; ?></td>
		</tr>
		<?php
		}
		?>
		</table>
</div>
</div>
<?php } ?>
<?php } ?>